﻿using Basic.HrRemoteModel.AppPower;
using Basic.HrRemoteModel.Power.Model;
using WeDonekRpc.Client.Attr;

namespace Basic.FlowExtendService.lmpl
{
    [ClassLifetimeAttr(ClassLifetimeType.SingleInstance)]
    internal class PowerService : IPowerService
    {
        public void Delete ( string linkType, long linkPk )
        {
            new DeleteAppPower
            {
                LinkType = linkType,
                LinkPk = linkPk
            }.Send();
        }
        public void Enable ( string linkType, long linkPk )
        {
            new SetAppPowerIsEnable
            {
                IsEnable = true,
                LinkPk = linkPk,
                LinkType = linkType
            }.Send();
        }
        public void Stop ( string linkType, long linkPk )
        {
            new SetAppPowerIsEnable
            {
                IsEnable = false,
                LinkPk = linkPk,
                LinkType = linkType
            }.Send();
        }
        public PowerData Find ( string linkType, long linkPk )
        {
            return new FindAppPower
            {
                LinkPk = linkPk,
                LinkType = linkType,
            }.Send();
        }

        public void Save ( PowerSet data, string linkType, long linkPk )
        {
            _ = new SaveAppPower
            {
                Power = data,
                LinkPk = linkPk,
                LinkType = linkType
            }.Send();
        }
    }
}
